@include('admin.common.header')

<!--tab nav start-->
<script>
    var ue = UE.getEditor('editor', {
        autoHeight: false,
    });

    ue.ready(function() {
        ue.setContent('{!!$active->content!!}');
        $('.form-submit').bind('click', function () {
            var html = ue.getContent();
            var id =$("input[name='id']").val();
            $.ajax({
                type: 'post',
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                url: '/admin/activity/gather/save',
                data: {content:html,id:id},
                dataType: 'json',
                success: function(res){
                    if (res.code==0){
                        layer.msg(res.msg);
                    }
                },
                error : function () {
                    layer.msg(res.msg);
                }
            });
        });
    });

</script>
<section class="panel">
    <header class="panel-heading tab-bg-dark-navy-blue ">
        <ul class="nav nav-tabs">
            <li @if ($_active['_action'] == 'list')  class="active" @endif>
                <a href="/admin/activity">活动列表</a>
            </li>
            <li @if ($_active['_action'] == 'gather')  class="active" @endif>
                <a href="/admin/activity/gather">活动合集</a>
            </li>
        </ul>
    </header>
    <div class="panel-body">
        <div class="tab-content">
            <div class="row cmxform form-horizontal tasi-form">
                <div class="col-lg-10">
                    <section class="panel">
                        <div class="panel-body">
                            <div class="form-group ">
                                <label for="name" class="control-label col-lg-2">活动合集</label>
                                <div class="col-lg-10">
                                    <input type="hidden" name="id" value="{{$active->id}}"/>
                                    <div style="width:1000px;height: 350px;" id="editor" name="cost_info"></div>
                                </div>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
            <div class="col-lg-12 text-center">
                <button class="btn btn-danger form-submit">提交</button>
            </div>
        </div>
    </div>
</section>
<!--tab nav start-->

@include('admin.common.footer')